<template>
  <el-col :span="col">
    <el-form-item :class="{ block: block }" :label="label" :label-width="labelWidth" :prop="prop" :required="required" :show-message="showMessage">
      <slot></slot>
    </el-form-item>
  </el-col>
</template>

<script>
export default {
  name: 'form-item',
  props: {
    col: {
      type: Number,
      default: 24,
    },
    label: {
      type: String,
      default: '',
    },
    labelWidth: {
      type: String,
    },
    prop: {
      type: String,
    },
    block: {
      type: Boolean,
      default: true,
    },
    required: {
      type: Boolean,
      default: false,
    },
    showMessage: {
      type: Boolean,
      default: true,
    },
  },
};
</script>

<style lang="scss" scoped>
.el-form-item {
  padding: 0 6px;

  &.block {
    ::v-deep .el-select {
      display: block;

      .el-input {
        .el-input__inner {
          max-width: 100%;
        }
      }
    }
  }

  ::v-deep .el-date-editor {
    width: 100%;
  }
}
</style>
